package com.jewelry.crm.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.Collection;

import static com.jewelry.crm.model.bo.UserBo.*;

@Controller
public class HomeController {

    @RequestMapping("/hello")
    public ModelAndView helloWorld() {

        String message = "Hello World, Spring 3.0!";
        return new ModelAndView("hello", "message", message);
    }

    @RequestMapping("/test")
    public ModelAndView test() {

        String message = "Test";
        return new ModelAndView("test", "message", message);
    }

    @RequestMapping("/index")
    public ModelAndView index() {
        return new ModelAndView("index");
    }

    @RequestMapping("/list")
    public ModelAndView list() throws Throwable{
        Collection users = getAllUsers();
        return new ModelAndView("list", "users", users);
    }

}
